package com.fusion.core.comm.rpc;

import com.fusion.core.comm.Packet;
import com.fusion.core.comm.RPC;
import com.fusion.core.comm.T;

import java.io.IOException;

/**
 * @author SwethaShivakumar 
 * Project: fusion
 * Date: Mar 7, 2009
 * URL: http://fusionwiki.co.cc
 * Mail Me At: shiva@fusionproject.co.cc
 */
public class NoRouteToHost extends RPC {
    private int hostGuid;

    public NoRouteToHost() {
        routable = true;
    }

    public NoRouteToHost(int hostGuid) {
        this.hostGuid = hostGuid;
    }

    public void execute(Packet in) throws IOException {
        int i = in.readInt();
        if(T.t)T.error("No Route to host: "+i);
        manager.getCore().getUICallback().noRouteToHost(manager.getNode(i));
    }

    public Packet serializeTo(Packet out) {
        out.writeInt(hostGuid);
        return out;
    }
}
